#ifndef ROOM_H
#define ROOM_H

#include <string>
#include <vector>
#include <map>
#include <random>
#include "Item.h"
#include "Enemy.h"

// Room type enumeration
enum class RoomType {
    NORMAL,    // Normal room
    HEALING,   // Healing room (restores health each turn)
    DAMAGING,  // Damaging room (causes damage each turn)
    TREASURE   // Treasure room (has better items)
};

class Room {
private:
    std::string name;
    std::string description;
    std::vector<Item*> items;           // Items in the room
    std::vector<Enemy*> enemies;        // Enemies in the room
    std::map<std::string, Room*> exits; // Exit directions and rooms they point to
    RoomType type;                      // Room type
    int roomEffect;                     // Room effect value

    // Random item generator
    static Item* generateRandomItem();

public:
    // Constructor and destructor
    Room(const std::string& _name, const std::string& _desc, RoomType _type = RoomType::NORMAL, int _effect = 0);
    ~Room();

    // Getters
    std::string getName() const;
    std::string getDescription() const;
    RoomType getType() const;
    int getRoomEffect() const;
    
    // Add and remove items
    void addItem(Item* item);
    Item* takeItem(size_t index);
    const std::vector<Item*>& getItems() const;
    
    // Add random item
    void addRandomItem();
    
    // Add and remove enemies
    void addEnemy(Enemy* enemy);
    void removeEnemy(size_t index);
    const std::vector<Enemy*>& getEnemies() const;
    
    // Room exit management
    void setExit(const std::string& direction, Room* room);
    Room* getExit(const std::string& direction) const;
    std::map<std::string, Room*> getExits() const;
    
    // Apply room effect
    int applyRoomEffect(ICharacter& character);
    
    // Display room information
    void displayRoom() const;
    
    // Room access operator overloading
    Room* operator[](const std::string& direction);
};

#endif // ROOM_H 